/*
	FileName : JT_C_Memory.h
	Description :
	Created on 2017.11.05 by WFL.

	Revision History:

*/



#ifndef  __JT_C_Memory_20171108__
#define  __JT_C_Memory_20171108__


#include "stdint.h"
#include "JT_C_SD_Structure.h"

//---------------------------------------------------------------------------



#define USB_INFO_DATA				((uint32_t)0x2001FF00)
//----------------------------



#define COPY_STATUS_ID1				0x33789243
#define COPY_STATUS_ID2				0x43927833

#define COPY_STATUS_ResetF_OK1		0X00		//USB device has not been remove yet.
#define COPY_STATUS_ResetF_OK2		0X80		//USB device has been removed
#define COPY_STATUS_ResetF_FAIL1	0X89		//USB device has been removed

//----------------------------
#define COPY_STATUS_TOTAL_LEN			53		//bit 32


#define COPY_STATUS_ID1_OFFSET			0		//bit 32
#define COPY_STATUS_ID2_OFFSET			1		//bit 32

#define COPY_STATUS_USBCONN_OFFSET		28		//bit 32

#define COPY_STATUS_BIOSSTARTF1_OFFSET		32		//bit 32
#define COPY_STATUS_BIOSSTARTF2_OFFSET		33		//bit 32
#define COPY_STATUS_posData_OFFSET		34		//bit 32	len = 12


#define COPY_STATUS_CRC_OFFSET			50		//bit 32


#define COPY_STATUS_UsbResultF_OFFSET	51		//bit 32

#define COPY_STATUS_resetF_OFFSET		53		//bit 32



//----------------------------------------------------------------------------


typedef struct{
	
	uint32_t ID1;
	uint32_t ID2;
	
	uint32_t trainNo;
	uint32_t CopyTm;
	
	uint32_t JwSecStartNo;
	uint32_t JwSecCnt;
	
	uint32_t KeySigSecStartNo;
	uint32_t KeySigFileCnt;
	
	uint32_t StsSecStartNo;
	uint32_t StsSecCnt;
	
	uint32_t SigSecStartNo;
	uint32_t MaxSigFileCnt;
	
	uint32_t Jw_CopyStart;
	uint32_t Jw_CopyCnt;
	
	uint32_t KeyAnaFile_CopyStart;
	uint32_t KeyAnaFile_CopyCnt;
	
	uint32_t StsSec_CopyStart;
	uint32_t StsSec_CopyCnt;
	
	uint32_t AnaFile_CopyStart;
	uint32_t AnaFile_CopyCnt;
}USB_COPY_MEM, *pUSB_COPY_MEM;

//----------------------------

void SetUsbCopyInfo(JTC_SD_STRUCTURE *jtcsd,
					POS_DATA *pos_d,
					uint32_t time,
					uint32_t jch_NO);

//----------------------------

uint8_t JT_C_Mem_ifIsStartFromUSB(void);
uint8_t JT_C_Mem_ifUSBCopyOK(void);
uint8_t JT_C_Mem_ifUsbResultFlagIs(uint32_t flag);
void JT_C_Mem_clearStartUpFlag(void);
uint32_t JT_C_Mem_getStartUpFlag(void);
void JT_C_Mem_setStartUpFlag(uint32_t value);
void JT_C_Mem_clearUSBCopyFlag(void);
void JT_C_Mem_clearUSBDisConnFlag(void);
void JT_C_Mem_setBiosStartFlag_USB(void);
void JT_C_Mem_setCrc(void);

uint32_t* JT_C_Mem_getPosAddr(void);
void JT_C_Mem_clearAll(void);

//----------------------------------------------------------------------------
#endif




///EOF


